package com.liuyi.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.liuyi.model.VisitReservation;
import com.liuyi.service.VisitReservationService;

/**
 * 
 * @ClassName: ShareController 
 * @Description: 报名信息展示录入类
 * @author: 12090
 * @date: 2018年10月22日 上午10:12:41
 */
@Controller
public class ShowController {

	@Autowired
	private VisitReservationService visitReservationService;
	
	/**
	 * 
	 * @Title: toSignUp 
	 * @Description: 跳转到报名信息填写页
	 * @return
	 * @return: String
	 */
	@RequestMapping("/toSignUp")
	public String toSignUp(){
	    return "show/visit_reservation";
    }
	
	@RequestMapping("/visitReservationEdit")
	@ResponseBody
	public String visitReservationEdit(HttpServletRequest request,
			@RequestParam(value = "id", required = false) Integer id,
			@RequestParam(value = "area", required = true)  String area,
			@RequestParam(value = "parentName", required = true)  String parentName,
			@RequestParam(value = "parentPhone", required = true) String parentPhone,
			@RequestParam(value = "studentName", required = true) String studentName,
			@RequestParam(value = "birthday", required = true) String birthday,
			@RequestParam(value = "gradeApplication", required = true) String gradeApplication,
			@RequestParam(value = "appointmentApplication", required = true) String appointmentApplication,
			@RequestParam(value = "appointmentTime", required = true) String appointmentTime){
		VisitReservation visitReservation = new VisitReservation();
		visitReservation.setArea(area);
		visitReservation.setParentName(parentName);
		visitReservation.setParentPhone(parentPhone);
		visitReservation.setStudentName(studentName);
		visitReservation.setBirthday(birthday);
		visitReservation.setGradeApplication(gradeApplication);
		visitReservation.setAppointmentApplication(appointmentApplication);
		visitReservation.setAppointmentTime(appointmentTime);
		
		visitReservationService.insert(visitReservation);
		return "<div style='background:url("+"/IMG_1389.JPG"+") no-repeat; width: 100%;background-size:cover;height:100%;'></div>";
	}
}
